package runesim.node;
import java.util.Arrays;
import runesim.node.io.*;
import runesim.node.model.*;
import static runesim.shared.ResponseCodes.*;
public class GenericWorldLoader implements WorldLoader {
	
	public void loadWorld(World w) {
		PlayerLoadQueue pl = new PlayerLoadQueue();
		pl.setLoader(new AccountLoader());
		w.setPlayerLoadQueue(pl);
		new Thread(pl, "PlayerLoadQueue").start();
	}
	
	static class AccountLoader implements PlayerLoader {
		
		/**
		 * Saves the player's profile.
		 */
		public void save(Player p) {

		}
		
		/**
		 * Loads the player's profile.
		 * This is where the login server will respond etc.
		 * 
		 * @return The response code?
		 */
		public byte load(Player p) throws UnsupportedOperationException {
			p.setAppearance(new PlayerAppearance(3, 19, 29, 35, 39, 44, 7, 8, 9, 5, 0));
			p.setLocation(Point.location(3221, 3218), true);
			int[] stats = new int[20];
			double[] XPs = new double[20];
			Arrays.fill(stats, 1);
			p.setCurrentStats(stats);
			p.setMaxStats(stats);
			Arrays.fill(XPs, 0D);
			p.setXPs(XPs);
			return (byte) RESPONSE_OK;
		}
	}
}